﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Lk.Common.Helper;
using MySql.Data.MySqlClient;

namespace OAuth.Common.Dapper
{
    public class DBConfig
    {
     
      
        private static readonly string DefaultSqlConnectionString = ConfigHelper.GetSection("appsettings.json", "ConnectionStrings", "MySqlServerConnection");

        public static IDbConnection GetSqlConnection(string sqlConnectionString = null)
        {
            if (string.IsNullOrWhiteSpace(sqlConnectionString))
            {
                sqlConnectionString = DefaultSqlConnectionString;
            }
            IDbConnection conn = new MySqlConnection(sqlConnectionString);
            conn.Open();
            return conn;
        }
    }
}
